home *** CD-ROM | disk | FTP | other *** search
/ GIFs Galore 1993 September / Walnut Creek GIFs Galore CDROM WIN-MAC (Walnut Creek CDROM)(September 1993).iso / pc / viewers / msdos / gifkit11.arc / 1001WAYS.TXT next >
Text File  |  1990-02-22  |  5KB  |  72 lines

  1.                     1001 Ways to Foul Up a GIF File
  2.                 Assorted Tips on the Use of the GIFKIT
  3.  
  4.  
  5.         The whole thing started because I get many of my GIF files from the
  6. Internet via one of the UNIX hosts here at Princeton University.  I wanted
  7. some way to do at least a cursory check of the GIF file before I spent time
  8. downloading it to my PC.  Thus there came to be GIFLS, which analyses and
  9. prints statistics on GIF files.  It also does rudimentary error checking.
  10.         While using GIFLS, I discovered that many GIF files have junk bytes
  11. on the end of the file, after the terminator.  While cataloging my GIF
  12. files last summer, I discovered that about 2/3 (out of 600+) had anywhere
  13. from one byte to 13K of junk pasted on the end.  Thus there came to be
  14. GIFSTRIP, which reblocks GIF files, eliminating junk characters.
  15.         Both GIFLS and GIFSTRIP do a lot of disk I/O (GIFLS when using the
  16. -l option for complete analysis).  Hence, I usually copy the GIF files to a
  17. ramdisk before using these programs.  It doesn't matter that much with
  18. GIFLS, but it is quite important with GIFSTRIP.  Because of the nature of a
  19. GIF file, GIFSTRIP thrashes the disk while copying the GIF file over.
  20. Obviously a ramdisk solves this problem.  However, there is the occasional
  21. GIF file which is larger than half the ramdisk (half the ramdisk because
  22. both the original and the temporary copy have to reside on the disk at
  23. once, as a failsafe).  The -t option takes care of this problem by allowing
  24. you to specify a path for the temporary file.  Thus it is possible to put
  25. only the temporary file on the ramdisk.  GIFSTRIP does one long read from
  26. the original disk and one long write back and doesn't thrash the disk. The
  27. -t option is also useful when there isn't room in the current directory for
  28. the temporary file.
  29.         I used GIFSTRIP in various incarnations on the 2/3 of 600+ files 
  30. mentioned above; never, under any circumstances, did it foul up irretrievably.
  31. If an error occurs before the original file is removed, the original file
  32. is left intact; if an error occurs afterward, the temporary file is left
  33. alone.  It never garbled the file, either, so if the temporary file is still
  34. around, you should be safe.
  35.         GIFCOLOR was written to solve another problem I encountered while
  36. cataloging: files which are essentially the same but have been enlarged or
  37. reduced.  Obviously, comparing pixels would be difficult and
  38. time-consuming.  However, comparing the color maps is quick and easy.  In
  39. many of these cases, the color map is untouched during the resizing.  Thus,
  40. identical color maps are a telltale clue.  GIFCOLOR also looks for
  41. grayscale images and repeated colors.  Lots of files have repeated colors;
  42. sometimes, in fact, the unique colors would fit in a much smaller color
  43. map.  GIFCOLOR will also dump the RGB values to the screen in a variety of
  44. ways and (on systems with MCGA or VGA) will display the colors, with
  45. labels.
  46.         Just when I thought I was safe, though, I encountered two pairs of
  47. files that looked identical but whose color maps (when I compared them,
  48. just to be sure) didn't match!  They weren't even just rearranged, they
  49. were completely different!  Upon dumping the maps, I discovered that many
  50. of the RGB values had been shifted by one or two.  Hardly a significant
  51. difference, but enough to throw off an exact compare.  Thus there came to
  52. be the fuzzy search, which allows you to specify a tolerance (i.e.
  53. comparison within a range instead of exact).
  54.     With this recentest release, I began pondering the fact that it is
  55. possible to specify searches according to image height, width, and colors
  56. in GIFLS but not in any of the other programs.  However, adding these options
  57. to the other programs would be difficult.  I managed to solve this problem
  58. by modifying GIFLS to serve as a front end for the other programs.  The -f
  59. option on GIFLS causes it to write a list of filenames to stdout.  This list
  60. can be piped to either GIFSTRIP or GIFCOLOR.   When either of these programs
  61. detects that its stdin has been redirected, it reads stdin for a list of
  62. targets.  This list need not come from GIFLS, either -- there programs can
  63. read from a file of targets.  The targets must be separated by newlines.
  64.         In conclusion, I hope you find these programs as useful as they
  65. have been to me.
  66.  
  67.         --James W. Birdsall
  68.  
  69.  
  70. GIF and "Graphic Interchange Format" are trademarks (tm) of CompuServe,
  71. Inc., an H&R Block company.
  72.